﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="s.aspx.cs" Inherits="WebApplication1.s" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>搜索</title>
	<script src="../assets/easyui/1.5.4.4/jquery.min.js"></script>
	<link href="../assets/layui/2.2.5/css/layui.css" rel="stylesheet" />
</head>
<body>
   <blockquote class="layui-elem-quote">
		<form id="form1" runat="server">
			<div>
				片名:
		<asp:TextBox ID="TextBox1" runat="server" CssClass="layui-inline"></asp:TextBox>

				<asp:Button ID="Button1" runat="server" Text="1搜索 2收录 3看片" OnClick="Button1_Click" CssClass="layui-inline" />

			</div>

		</form>
	</blockquote>
	<blockquote class="layui-elem-quote">
		<div id="view"></div>
	</blockquote>
	<div>
		<table id="demo" lay-filter="test"></table>

		<script type="text/html" id="titleTpl">
			{{#  if(d.VideoType ==0){ }}
    专辑(多 )
  {{#  } else { }}
    视频
  {{#  } }} 
		</script>
		<script type="text/html" id="titleTp2">
			{{#  if(d.VideoType ==0){ }}
			<a href="aaa.aspx?purl={{d.Url}}" target="_blank" class="layui-table-link">{{d.Title}}</a>
			{{#  } else { }}
    <a href="http://jx.jqaaa.com/index.php?v={{d.Url}}" target="_blank" class="layui-table-link">{{d.Title}}</a>
			{{#  } }}  
		</script>

		<script type="text/html" id="keyTp">
			{{#  layui.each(d.list, function(index, item){ }}
   <a href="#" class="layui-btn layui-btn-warm" onclick="getByName('{{item.Name}}')">{{item.Name}}</a>
{{#  }); }}
			

		</script>
	</div>
	<%--http://jx.jqaaa.com/index.php?v={{d.Url}}--%>
	<script src="../assets/layui/2.2.5/layui.all.js"></script>
	<script>
		var data = [];
		//一般直接写在一个js文件中
		layui.use(['layer', 'form', 'table', 'jquery'], function () {
			var layer = layui.layer
				, form = layui.form
				, table = layui.table
				, $ = layui.jquery
				,laytpl=layui.laytpl;

			$.getJSON('f.aspx', function (rsp) {

				 

				//第三步：渲染模版
				var data = { //数据
					"Title": "Layui常用模块"
					, "list": rsp
				}
				var getTpl = keyTp.innerHTML
					, view = document.getElementById('view');
				laytpl(getTpl).render(data, function (html) {
					view.innerHTML = html;
				});
			});



			//第一个实例
			table.render({
				elem: '#demo'
				, url: 'aa.aspx' //数据接口
				, page: true //开启分页
				, cols: [[ //表头
					{ field: 'VideoType', title: '类型', templet: '#titleTpl' }
					, { field: 'Title', title: '片名', templet: '#titleTp2' }

				]],
				done: function (res, curr, count) {
					data = res.data;

				}
			});
		});


		function getByName(name) {

			$.post('', { name: name }, function (rsp) {


			});
		}

	</script>
</body>
</html>
